($LOAD_PATH << File.dirname(__FILE__)) unless $LOAD_PATH.include? File.dirname(__FILE__)

require "cgi"
require "rubygems"
require "httparty"
require "json"
require "singly/logger"
require "singly/endpoint"
require "singly/api/services/service"

# Descend into and require the entire project
Dir["#{File.dirname(__FILE__)}/**/*.rb"].each {|f| require(f)}

module Singly
  @version = "v0"
  @timeout = 2 # In seconds

  class << self
    attr_accessor :client_id
    attr_accessor :client_secret
    attr_accessor :verbose
    attr_accessor :version
    attr_accessor :timeout

    def services
      Singly::Services.new
    end

    def account(access_token, account=nil)
      Singly::Account.new(access_token, account)
    end

    def auth
      Singly::Auth.new
    end

    def multi(urls)
      Singly::Multi.new(urls: urls.join(","))
    end
  end
end